<template>
	<view style="background-color: lightgreen; height: 120px;" class="flex-ai-cen">
		<text style="font-size: 50rpx"> 子组件B</text>
		<view class="comb_box">
			<text>ComA组件传进来的值：</text>
			<text style="font-weight: bold; color: white; background-color: blue;">{{result}}</text>
		</view>
		<view class="flex-jc-bet" style="margin-top: 10px;">
			<text>回传值：</text>
			<input type="text" v-model="callbackValue" style="color: yellow;" />
			<button @click="sendOutside()" size="mini">传回</button>
		</view>
	</view>
</template>

<script>
	export default {
		name: "comB",
		data() {
			return {
				result:""
			};
		},
		methods: {
			sendOutside() {
				console.log("compB---->", this.callbackValue);
				this.$emit('callBackFun', this.callbackValue);
			}
		},
		created() {
			console.log("comB--creatted-->");
			uni.$on('getIntent', (msg) => {
				console.log("comB---getIntent-->", msg);
				this.result = msg;
			})
		}
	}
</script>

<style>

</style>